package cn.jiyun.function.service.impl;

import cn.jiyun.function.mapper.BackstageCarMapper;
import cn.jiyun.function.service.BackstageCarService;
import cn.jiyun.pojo.BackstageCar;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BackstageCarServiceImpl implements BackstageCarService {
    @Autowired
    private BackstageCarMapper backstageCarMapper;

    @Override
    public PageInfo<BackstageCar> findPage(Integer pageNum, Integer pageSize, BackstageCar brokerCar) {
        Page<BackstageCar> backstageCars = PageHelper.startPage(pageNum, pageSize);
        List<BackstageCar> backstageCarList = backstageCarMapper.findPage(backstageCars,brokerCar);

        return new PageInfo<>(backstageCarList);
    }

    @Override
    public void insertHuodong(BackstageCar backstageCar) {
        backstageCarMapper.insertHuodong(backstageCar);
    }

    @Override
    public BackstageCar findById(Integer id) {
        return backstageCarMapper.findById(id);
    }

    @Override
    public void updateBack(BackstageCar backstageCar) {
        backstageCarMapper.updateBack(backstageCar);
    }
}
